<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('rd_device_serial', function (Blueprint $table) {
            $table->comment('录像机设备');
            $table->bigIncrements('id');
            $table->bigInteger('rod_id')->comment('装置ID');
            $table->integer('online')->default(1)->comment('1上线 2下线');
            $table->string('name', 255)->comment('名称');
            $table->bigInteger('voice_id')->nullable()->comment('名称语音ID');
            $table->bigInteger('comply_id')->comment('遵守语音ID');
            $table->json('url')->nullable()->comment('流媒体地址');
            $table->string('device_serial', 255)->nullable()->comment('设备序列号');
            $table->string('channel_no', 255)->nullable()->comment('通道号');
            $table->unsignedTinyInteger('type')->comment('设备类型 1:枪机 2:球机');
            $table->integer('stand_id')->comment('站点id');
            $table->integer('sort')->default(0)->comment('排序');
            $table->string('remarks', 255)->nullable()->comment('备注');
            $table->unsignedBigInteger('prompt_id')->nullable()->comment('提示语ID');
            $table->string('addr', 255)->comment('地址')->nullable();
            $table->timestamps();
            $table->softDeletes();
            $table->authorBy();
            $table->index('name', 'idx_name');
            $table->index('stand_id', 'idx_stand_id');
            $table->index('device_serial', 'idx_device_serial');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('rd_device_serial');
    }
};
